<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./lib/vue_2.5.22.js"></script>
    <script src="./lib/vue-router_3.0.2.js"></script>
</head>

<body>
    <div id="app">
        <!-- 创建路由标签 使用router-link组件来导航 -->
        <router-link to="/login">login</router-link>
        <router-link to="/register">register</router-link>
        <!-- 创建占位符 -->
        <router-view></router-view>

    </div>
    <script>
        //创建路由组件
        var Login = {
            template: `
            <div>
            <h4>登录</h4>
            </div>
            `
        }
        var Register = {
                template: `
            <div>
            <h4>注册</h4>
            </div>
            `
            }
            //创建路由规则
        var router = new VueRouter({
            routes: [{
                path: '/login',
                component: Login
            }, {
                path: '/register',
                component: Register
            }]
        })
        var vm = new Vue({
            el: '#app',
            router
            // 将路由对象进行挂载
        })
    </script>
</body>

</html>